#include <iostream>
#include <cstdio>
#include <chrono>
#include <vector>
using namespace std;

constexpr size_t max_n = 3e8;

int main()
{
    // Generate Data.
    cout << "Generating Data..." << endl;
    auto fo = fopen("./test.txt", "wt");
    for (size_t i = 0; i < max_n; ++i)
    {
        fprintf(fo, "%c", 'a' + i % 26);
    }
    fclose(fo);

    cout << "Testing..." << endl;

    auto fi = fopen("./test.txt", "rt");
    char c;
    auto start = chrono::system_clock::now();
    for (size_t i = 0; i < max_n; ++i)
    {
        fscanf(fi, "%c", &c);
    }
    auto end = chrono::system_clock::now();

    fclose(fi);

    auto total_time = chrono::duration_cast<chrono::milliseconds>(end - start);
    cout << "Time Cost: " << total_time.count() << "ms" << endl;

    return 0;
}